<template>
  <div class="my-content">
    <!-- 头部区域 -->
    <div class="header-section">
      <img src="/images/主体页面组件/头部header.svg" alt="头部背景" class="header-bg" />
      <div class="header-content">
        <img src="/images/主体页面组件/头部蓝酒馆logo.svg" alt="蓝酒馆logo" class="header-logo" />
        <img src="/images/主体页面组件/头部slogan.svg" alt="slogan" class="header-slogan" />
      </div>
    </div>

    <!-- 主内容区域 -->
    <div class="main-content">
      <!-- 用户信息区域 -->
      <div class="user-info-section">
        <img src="/images/我的/我的bg1.svg" alt="用户信息背景" class="user-bg" />
        <div class="user-info-overlay">
          <div class="user-profile">
            <img src="/images/wxavatar.svg" alt="用户头像" class="user-avatar" />
            <div class="user-details">
              <img src="/images/我的/KISS.svg" alt="KISS" class="user-name" />
              <img src="/images/我的/今日已阅读89分钟.svg" alt="今日已阅读89分钟" class="reading-time" />
            </div>
          </div>
          <button class="switch-account-btn" @click="switchAccount">
            <img src="/images/我的/切换账号按钮.svg" alt="切换账号" />
          </button>
        </div>
      </div>

      <!-- 功能菜单区域 -->
      <div class="menu-section">
        <img src="/images/我的/我的bg2.svg" alt="菜单背景" class="menu-bg" />
        <div class="menu-items">
          <button class="menu-item" @click="goToMyReading">
            <img src="/images/我的/我的阅读.svg" alt="我的阅读" class="menu-icon" />
            <span class="arrow">></span>
          </button>
          <button class="menu-item" @click="goToMyBookshelf">
            <img src="/images/我的/我的书架.svg" alt="我的书架" class="menu-icon" />
            <span class="arrow">></span>
          </button>
          <button class="menu-item" @click="goToMyFollow">
            <img src="/images/我的/我的关注.svg" alt="我的关注" class="menu-icon" />
            <span class="arrow">></span>
          </button>
          <button class="menu-item" @click="goToMyLike">
            <img src="/images/我的/我的喜欢.svg" alt="我的喜欢" class="menu-icon" />
            <span class="arrow">></span>
          </button>
          <button class="menu-item" @click="goToMyRecommend">
            <img src="/images/我的/我的推荐.svg" alt="我的推荐" class="menu-icon" />
            <span class="arrow">></span>
          </button>
          <button class="menu-item" @click="goToSettings">
            <img src="/images/我的/设置.svg" alt="设置" class="menu-icon" />
            <span class="arrow">></span>
          </button>
        </div>
      </div>
    </div>

    <!-- 底部导航栏 -->
    <div class="bottom-nav">
      <img src="/images/主体页面组件/底部导航栏bg.svg" alt="导航背景" class="nav-bg" />
      <div class="nav-items">
        <button class="nav-item" @click="$router.push('/home')">
          <img src="/images/主体页面组件/首页logo.svg" alt="首页" />
          <span class="nav-text">首页</span>
        </button>
        <button class="nav-item" @click="$router.push('/recommend')">
          <img src="/images/主体页面组件/推荐logo.svg" alt="推荐" />
          <span class="nav-text">推荐</span>
        </button>
        <button class="nav-item" @click="$router.push('/bookshelf')">
          <img src="/images/主体页面组件/书架logo.svg" alt="书架" />
          <span class="nav-text">书架</span>
        </button>
        <button class="nav-item active">
          <img src="/images/主体页面组件/我的logo.svg" alt="我的" />
          <span class="nav-text">我的</span>
        </button>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()

// 功能导航方法
const switchAccount = () => {
  // 切换账号逻辑
  console.log('切换账号')
}

const goToMyReading = () => {
  // 跳转到我的阅读页面
  console.log('我的阅读')
}

const goToMyBookshelf = () => {
  // 跳转到我的书架页面
  router.push('/bookshelf')
}

const goToMyFollow = () => {
  // 跳转到我的关注页面
  console.log('我的关注')
}

const goToMyLike = () => {
  // 跳转到我的喜欢页面
  router.push('/my-like')
}

const goToMyRecommend = () => {
  // 跳转到我的推荐页面
  router.push('/my-recommend')
}

const goToSettings = () => {
  // 跳转到设置页面
  console.log('设置')
}
</script>

<style scoped>
.my-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  background: #f5f5f5;
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  /* 禁用文本选择和拖拽 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* 头部区域样式 */
.header-section {
  position: relative;
  width: 100%;
  height: 65px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  background: #A2F2F8;
}

.header-bg {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
}

.header-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.header-logo {
  height: 30px;
  width: auto;
  transform: translateY(35%) translateX(10%);
}

.header-slogan {
  height: 40px;
  width: auto;
  transform: translateY(35%) translateX(50%);
}

/* 主内容区域样式 */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 15px;
  padding-bottom: 120px; /* 为导航栏留出空间 */
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 0;
  min-height: 0;
  /* 启用移动端原生滑动 */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* 隐藏滚动条 */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* 完全隐藏滚动条 */
.main-content::-webkit-scrollbar {
  display: none;
}

/* 用户信息区域样式 */
.user-info-section {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  height: 160px;
  flex-shrink: 0;
}

.user-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.user-info-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 25px;
  z-index: 5;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background-color: #f0f0f0;
  border: 2px solid #ddd;
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-name {
  height: 18px;
  width: auto;
  object-fit: contain;
}

.reading-time {
  height: 12px;
  width: auto;
  object-fit: contain;
}

.switch-account-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s ease;
  position: absolute;
  top: 10px;
  right: 15px;
}

.switch-account-btn:hover {
  transform: scale(1.05);
}

.switch-account-btn img {
  height: 28px;
  width: auto;
}

/* 功能菜单区域样式 */
.menu-section {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  flex: 1;
  min-height: 400px;
}

.menu-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  position: absolute;
  top: 0;
  left: 0;
}

.menu-items {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  z-index: 5;
}

.menu-item {
  background: none;
  border: none;
  cursor: pointer;
  padding: 15px 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.2s ease;
  width: 100%;
  text-align: left;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.menu-icon {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.arrow {
  color: #00D4FF;
  font-size: 18px;
  font-weight: bold;
  margin-right: 10px;
}

/* 底部导航栏样式 */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  z-index: 9999;
  margin: 0;
  padding: 0;
  background: transparent;
  padding-top: 5px;
}

.nav-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-items {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 0px 20px 20px 20px;
}

.nav-item {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px 12px 8px;
  transition: transform 0.2s ease;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

.nav-item:hover {
  transform: scale(1.1);
}

.nav-item.active {
  background: rgba(0, 212, 255, 0.1);
}

.nav-item img {
  height: 32px;
  width: auto;
}

.nav-text {
  font-size: 12px;
  color: #ffffff;
  font-weight: 400;
  margin-top: 2px;
}

.nav-item.active .nav-text {
  color: #0033ff;
  font-weight: 500;
}

/* 响应式调整 */
@media (max-height: 700px) {
  .header-section {
    height: 55px;
  }
  
  .main-content {
    padding: 12px;
    padding-bottom: 90px;
    gap: 12px;
  }
  
  .user-info-section {
    height: 140px;
  }
  
  .user-info-overlay {
    padding: 15px 20px;
  }
  
  .user-avatar {
    width: 50px;
    height: 50px;
  }
  
  .user-name {
    height: 20px;
  }
  
  .reading-time {
    height: 14px;
  }
  
  .menu-items {
    padding: 15px 0;
  }
  
  .menu-item {
    padding: 12px 20px;
  }
  
  .menu-icon {
    height: 24px;
  }
  
  .bottom-nav {
    height: 80px;
  }
  
  .nav-item img {
    height: 28px;
  }
  
  .nav-text {
    font-size: 11px;
  }
}

/* 小屏幕调整 */
@media (max-width: 399px) {
  .user-info-overlay {
    padding: 15px 18px;
  }
  
  .user-profile {
    gap: 12px;
  }
  
  .user-avatar {
    width: 48px;
    height: 48px;
  }
  
  .switch-account-btn img {
    height: 28px;
  }
  
  .menu-item {
    padding: 12px 18px;
  }
  
  .menu-icon {
    height: 26px;
  }
  
  .arrow {
    font-size: 16px;
  }
}

/* 大屏幕优化 */
@media (min-width: 400px) {
  .user-info-section {
    height: 170px;
  }
  
  .user-avatar {
    width: 65px;
    height: 65px;
  }
  
  .user-name {
    height: 26px;
  }
  
  .reading-time {
    height: 18px;
  }
  
  .menu-icon {
    height: 30px;
  }
  
  .arrow {
    font-size: 20px;
  }
}
</style> 